package com.ssy.lingxi.settle.accounts.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 对公账户配置更新枚举
 * @author 伍将
 * @date 2020/12/17
 * @version 2.0.0
 */
public enum AccountConfigUpdateEnum {

    /**
     * 账户名称 - 1
     */
    NAME(1, "账户名称"),
    /**
     * 银行账号 - 2
     */
    BANK_ACCOUNT(2, "银行账号"),
    /**
     * 开户行 - 3
     */
    BANK_DEPOSIT(3, "开户行");

    private final Integer code;
    private final String message;


    AccountConfigUpdateEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
       return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public static AccountConfigUpdateEnum getItem(Integer code) {
        return Arrays.stream(AccountConfigUpdateEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
